package com.lb.jdbc;

import java.sql.*;

public class Update {
    public static void main(String[] args) throws Exception {

        Connection conn = JdbcUtils.getCon();
        //获取sql语句的执行对象
        Statement statement = conn.createStatement();
        //定义sql语句
        String sql = "update emp set ` job`='总监' where ename='张三'";
        //执行sql语句
        int count = statement.executeUpdate(sql);
        System.out.println("count::"+count);
        //对结果进行操作
        if (count > 0) {
            System.out.println("数据库更新成功！");
        }else{
            System.out.println("数据库更新失败！");
        }
        //释放资源
        JdbcUtils.close(statement,conn);

    }

}
